//
//  BDBindQrSuccessViewController.m
//  HSY
//
//  Created by 陈浩 on 2017/4/13.
//  Copyright © 2017年 金开门. All rights reserved.
//

#import "BDBindQrSuccessViewController.h"

@interface BDBindQrSuccessViewController ()

@property (weak, nonatomic) IBOutlet UILabel *qrCodeLabel;
@property (weak, nonatomic) IBOutlet UILabel *shopNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *alipayRateLabel;
@property (weak, nonatomic) IBOutlet UILabel *weiChatPayRateLabel;


@end

@implementation BDBindQrSuccessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.qrCodeLabel.text = self.model.qrCode.code;
    self.alipayRateLabel.text = [NSString stringWithFormat:@"%@%%",[self stringDisposeWithFloat:100*self.model.appBizShop.alipayRate]];
    
    self.shopNameLabel.text = self.model.appBizShop.shortName;
    self.weiChatPayRateLabel.text = [NSString stringWithFormat:@"%@%%",[self stringDisposeWithFloat:100*self.model.appBizShop.weixinRate]];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(NSString *)stringDisposeWithFloat:(float)floatValue{
    NSString *str = [NSString stringWithFormat:@"%f",floatValue];
    long len = str.length;
    for (int i = 0; i < len; i++){
        if (![str  hasSuffix:@"0"])
            break;
        else
            str = [str substringToIndex:[str length]-1];
    }
    if ([str hasSuffix:@"."]){//避免像2.0000这样的被解析成2.
        //s.substring(0, len - i - 1);
        return [str substringToIndex:[str length]-1];
    }
    else{
        return str;
    }
}

- (IBAction)compliteBtnClick:(id)sender {
    [self.navigationController popToRootViewControllerAnimated:YES];
    
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
